package com.yxinsur.imc.business.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yxinsur.imc.business.domain.ImcContractExpense;
import com.yxinsur.imc.business.domain.ImcContractExpenseExpression;
import com.yxinsur.imc.business.vo.ContractExpenseVo;
import com.yxinsur.imc.business.vo.ContractVo;
import com.yxinsur.imc.business.vo.ImcContractExpenseVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 协议-费用科目 Mapper接口
 *
 * @author imc
 * @date 2021-07-28
 */
@Mapper
public interface ImcContractExpenseMapper extends BaseMapper<ImcContractExpense> {
    /**
     * 查询协议费用科目列表
     *
     * @param id       协议id
     * @param tenantId 租户id
     * @return List<ImcContractExpenseVo>
     */
    List<ImcContractExpenseVo> listImcContractExpenseByContractId(@Param("contractId") Long id, @Param("tenantId") Long tenantId);

    /**
     * 查询协议费用科目详情
     *
     * @param id 协议费用科目id
     * @return ImcContractExpense
     */
    ImcContractExpense getImcContractExpenseById(@Param("id") Long id);

    /**
     * 查询协议费用科目详情
     *
     * @param id 协议费用科目id
     * @return ImcContractExpense
     */
    ContractExpenseVo getImcContractExpenseVoById(@Param("id") Long id);

    /**
     * 根据{协议费用科目ID}查询协议费用科目名称
     *
     * @param id 协议费用科目ID
     * @return 协议-费用科目名称
     */
    String getExpenseNameById(@Param("id") Long id);

    /**
     * 协议费用科目-根据{协议id}、{供应商费用科目id}查询详情
     *
     * @param contractId        协议id
     * @param supplierExpenseId 供应商费用科目id
     * @return ImcContractExpense
     */
    ImcContractExpense getImcContractExpenseByContractIdAndSupplierExpenseId(@Param("contractId") Long contractId, @Param("supplierExpenseId") Long supplierExpenseId);

    /**
     * 新增协议费用科目
     *
     * @param imcContractExpense 协议费用科目
     * @return 结果
     */
    int insertImcContractExpense(ImcContractExpense imcContractExpense);

    /**
     * 修改协议费用科目
     *
     * @param imcContractExpense 协议费用科目
     * @return 结果
     */
    int updateImcContractExpense(ImcContractExpense imcContractExpense);

    /**
     * 删除协议费用科目
     *
     * @param id 协议费用科目id
     * @return 结果
     */
    int deleteImcContractExpenseById(@Param("id") Long id);

    /**
     * 根据{选择月度}、{供应商id}查询协议
     *
     * @param settleMonth 选择月度
     * @param supplierId  供应商id
     * @param tenantId    租户id
     * @return 协议
     */
    List<ContractVo> listImcContractBySettleMonthAndSupplierId(@Param("settleMonth") String settleMonth, @Param("supplierId") Long supplierId, @Param("tenantId") Long tenantId);

    /**
     * 根据{协议ID}查询协议费用科目
     *
     * @param contractIds 协议ID集合
     * @param expenseType 协议费用科目类型
     * @param tenantId    租户ID
     * @return 协议费用科目
     */
    List<ContractExpenseVo> listImcContractExpenseByContractIds(@Param("contractIds") List<Long> contractIds, @Param("expenseType") String expenseType, @Param("tenantId") Long tenantId);

    /**
     * 根据{协议费用科目ID集合}查询协议费用科目
     *
     * @param contractExpenseIds 协议费用科目ID集合
     * @param tenantId           租户ID
     * @return 协议费用科目
     */
    List<ContractExpenseVo> listContractExpenseByIds(@Param("contractExpenseIds") List<Long> contractExpenseIds, @Param("tenantId") Long tenantId);

    /**
     * 根据{协议费用科目id}查询协议费用科目表达式
     *
     * @param contractExpenseId 协议费用科目id
     * @return List<ImcContractExpenseExpression>
     */
    List<ImcContractExpenseExpression> listImcContractExpenseExpressionByContractExpenseId(@Param("contractExpenseId") Long contractExpenseId);
}
